package com.fish.anne.model;

import com.fish.anne.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="member_attr_value" )
public class MemberAttrValue extends BaseObject implements Serializable {
    private Long maId;
    private Long attrId;
    private Long memberId;
    private String attrValue;

    @Id   @GeneratedValue(strategy = GenerationType.AUTO)    
    public Long getMaId() {
        return this.maId;
    }
    
    public void setMaId(Long maId) {
        this.maId = maId;
    }
    
    @Column(name="attr_id", nullable=false)
    public Long getAttrId() {
        return this.attrId;
    }
    
    public void setAttrId(Long attrId) {
        this.attrId = attrId;
    }
    
    @Column(name="member_id", nullable=false)
    public Long getMemberId() {
        return this.memberId;
    }
    
    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }
    
    @Column(name="attr_value", nullable=false, length=100)
    public String getAttrValue() {
        return this.attrValue;
    }
    
    public void setAttrValue(String attrValue) {
        this.attrValue = attrValue;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MemberAttrValue pojo = (MemberAttrValue) o;

        if (attrId != null ? !attrId.equals(pojo.attrId) : pojo.attrId != null) return false;
        if (memberId != null ? !memberId.equals(pojo.memberId) : pojo.memberId != null) return false;
        if (attrValue != null ? !attrValue.equals(pojo.attrValue) : pojo.attrValue != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (attrId != null ? attrId.hashCode() : 0);
        result = 31 * result + (memberId != null ? memberId.hashCode() : 0);
        result = 31 * result + (attrValue != null ? attrValue.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("maId").append("='").append(getMaId()).append("', ");
        sb.append("attrId").append("='").append(getAttrId()).append("', ");
        sb.append("memberId").append("='").append(getMemberId()).append("', ");
        sb.append("attrValue").append("='").append(getAttrValue()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
